A Netskope foi reconhecida como líder novamente no Quadrante Mágico do Gartner®™ para plataformas SASE. Obtenha o relatório

fechar
fechar
Sua Rede do Amanhã
Sua Rede do Amanhã
Planeje seu caminho rumo a uma rede mais rápida, segura e resiliente projetada para os aplicativos e usuários aos quais você oferece suporte.
          Experimente a Netskope
          Coloque a mão na massa com a plataforma Netskope
          Esta é a sua chance de experimentar a plataforma de nuvem única do Netskope One em primeira mão. Inscreva-se em laboratórios práticos e individualizados, junte-se a nós para demonstrações mensais de produtos ao vivo, faça um test drive gratuito do Netskope Private Access ou participe de workshops ao vivo conduzidos por instrutores.
            Líder em SSE. Agora é líder em SASE de fornecedor único.
            A Netskope é reconhecida como a líder mais avançada em visão para as plataformas SSE e SASE
            2X é líder no Quadrante Mágico do Gartner® para plataformas SASE
            Uma plataforma unificada criada para sua jornada
              Protegendo a IA generativa para leigos
              Protegendo a IA generativa para leigos
              Saiba como sua organização pode equilibrar o potencial inovador da IA generativa com práticas robustas de segurança de dados.
                E-book moderno sobre prevenção de perda de dados (DLP) para leigos
                Prevenção Contra Perda de Dados (DLP) Moderna para Leigos
                Obtenha dicas e truques para fazer a transição para um DLP fornecido na nuvem.
                  Livro SD-WAN moderno para SASE Dummies
                  SD-WAN moderno para leigos em SASE
                  Pare de brincar com sua arquitetura de rede
                    Compreendendo onde estão os riscos
                    O Advanced Analytics transforma a maneira como as equipes de operações de segurança aplicam insights orientados por dados para implementar políticas melhores. Com o Advanced Analytics, o senhor pode identificar tendências, concentrar-se em áreas de preocupação e usar os dados para tomar medidas.
                        Suporte Técnico Netskope
                        Suporte Técnico Netskope
                        Nossos engenheiros de suporte qualificados estão localizados em todo o mundo e têm diversas experiências em segurança de nuvem, rede, virtualização, fornecimento de conteúdo e desenvolvimento de software, garantindo assistência técnica de qualidade e em tempo hábil.
                          Vídeo da Netskope
                          Treinamento Netskope
                          Os treinamentos da Netskope vão ajudar você a ser um especialista em segurança na nuvem. Conte conosco para ajudá-lo a proteger a sua jornada de transformação digital e aproveitar ao máximo as suas aplicações na nuvem, na web e privadas.

                            Malicious Office Documents: Multiple Ways to Deliver Payloads

                            Nov 19 2021

                            Co-authored by Gustavo Palazolo and Ghanashyam Satpathy

                            Summary

                            Several malware families are distributed via Microsoft Office documents infected with malicious VBA code, such as Emotet, IceID, Dridex, and BazarLoader. We have also seen many techniques employed by attackers when it comes to infected documents, such as the usage of PowerShell and WMI to evade signature-based threat detection. In this blog post, we will show three additional techniques attackers use to craft malicious Office documents.

                            Technique 01: VBA Code Executing Shellcode via Process Injection

                            The first technique involves a malicious VBA script that is used to execute a shellcode, which eventually leads to the deployment of other malware.

                            The VBA code is automatically executed with the “AutoOpen” feature, and from extracted macro code, we can see references to Windows APIs that are often used for process injection.

                            Screenshot of Windows APIs used by the VBA code.
                            Windows APIs used by the VBA code.

                            Going further, we can find a large array with integers, which are all the bytes of the shellcode.

                            Example of shellcode bytes within an array.
                            Shellcode bytes within an array.

                            And finally, we have the code that is responsible for executing the shellcode.

                            In this case, the code will be injected into “rundll32.exe” through a popular technique:

                            1. A “rundll32.exe” process is created with CreateProcessA, named “RunStuff”;
                            2. The code allocates a memory space in the process with VirtualAllocEx, named “AllocStuff”;
                            3. The shellcode is written into the newly allocated space with WriteProcessMemory, named “WriteStuff”.
                            4. Lastly, the shellcode is executed through CreateRemoteThread, named “CreateStuff”.

                            Once the shellcode is running, it contacts a malicious server to download the next stage, which can be any additional malware the attacker desires.

                            Screenshot of Shellcode executed through the infected document.
                            Shellcode executed through the infected document.

                            Technique 02: VBA Code Abusing Certutil

                            This one is a bit more interesting than the first one, as the malicious VBA code is using a Living-off-the-Land technique to carry out the attack.

                            After extracting the macro, we can see that the malware uses the “AutoOpen” feature to execute two functions, respectively “DropThyself” and “EstablishThyself”.

                            Screenshot of Functions executed once the document is opened.
                            Functions executed once the document is opened.

                            The first called function creates a file named “GoogleUpdater.crt” and writes a large base64 content in the certificate format.

                            Screenshot of Function dropping the fake certificate in the disk.
                            Function dropping the fake certificate in the disk.

                            The file is a base64 encoded executable, which is the second stage of the malware. The content is decoded through a Living-off-the-Land technique using the “certutil.exe” binary.

                            This is the same technique that was used by the REvil ransomware in the Kaseya attack, where the attacker claimed to have infected more than one million devices around the world.

                            Screenshot of Payload being decoded through “certutil.exe”
                            Payload being decoded through “certutil.exe”

                            After the second stage is decoded, the VBA function “EstablishThyself” creates a simple persistence through Windows registry.

                            Screenshot of Second-stage executed through simple persistence technique
                            Second-stage executed through simple persistence technique

                            In this case, the payload is an agent from a .NET Command & Control framework named Covenant. The file is packed and once running, the entry point executes a shellcode through VirtualAlloc, VirtualProtect, and CreateThread APIs.

                            Screenshot of Shellcode allocated and executed.
                            Shellcode allocated and executed.

                            The shellcode then unpacks the final stage.

                            Example of Payload being unpacked.
                            Payload being unpacked.

                            Since Covenant is developed in .NET, we can decompile the binary to extract additional information about the agent.

                            Screenshot of Final payload decompiled.
                            Final payload decompiled.

                            Technique 03: VBA Code Executing Shellcode via PowerShell

                            This technique is similar to the first one, however, the shellcode is executed through obfuscated PowerShell.

                            And again we see the “AutoOpen” feature of VBA Macro being used. At the beginning of the code, we see a large string being concatenated, likely to evade detection.

                            Screenshot of PowerShell script executed by the macro.
                            PowerShell script executed by the macro.

                            Later, the script is executed through a shell object, where the VBA code also uses concatenation in its strings:

                            Screenshot of PowerShell being executed by the code.
                            PowerShell being executed by the code.

                            After running the script, the macro shows a fake error message to deceive the victim.

                            Screenshot of VBA code displaying a fake message and exiting.
                            VBA code displaying a fake message and exiting.

                            The main PowerShell script is encoded with base64, and once we decode it, it’s possible to see APIs related to process injection and a large array of bytes, similar to the first technique.

                            Screenshot of PowerShell script to inject shellcode.
                            PowerShell script to inject shellcode.

                            The shellcode is also very similar to the one found in the first technique.

                            Screenshot of shellcode execution
                            Shellcode execution.

                            Conclusion

                            We have reviewed three different techniques that are being used by attackers to deliver malware through Microsoft Office documents containing malicious VBA code. It’s interesting to note that despite the differences between them, they are all abusing the “AutoOpen” function within the VBA macros to execute the malware once the document is opened and the user has enabled macros.

                            The above techniques demonstrate the importance of a strong security solution, as well as security training since these attack vectors can be avoided by not opening unknown attachments, or not enabling macro execution from unknown documents. Moreover, Microsoft has recommended blocking the macro execution through group policy settings by the enterprise administrator in Office 2016 onwards.

                            Protection

                            Netskope Threat Labs is actively monitoring infected documents and ensuring coverage for these types of threats.

                            author image
                            Gustavo Palazolo
                            Gustavo Palazolo is an expert in malware analysis, reverse engineering and security research, working many years in projects related to electronic fraud protection.
                            Gustavo Palazolo is an expert in malware analysis, reverse engineering and security research, working many years in projects related to electronic fraud protection.
                            Conecte-se com a Netskope

                            Subscribe to the Netskope Blog

                            Sign up to receive a roundup of the latest Netskope content delivered directly in your inbox every month.